﻿@using System.Web.Script.Serialization
@using DataMongo.Entities
@model string
@{
    var serializer = new JavaScriptSerializer();
    int groupid = Convert.ToInt32(Model);
}
<div style="padding-top: 20px" class="span8">
    <div class="publishContainer">

        <textarea class="msgTextArea" id="txtMessage" data-bind="value: newMessage, jqAutoresize: {},event: { blur: blurFunction }" style="height:3em;" placeholder="What's on your mind?"></textarea>
        <div class="row-fluid" id="preview-display" style="display: none">
            <input class="msgTextArea" id="Postsource" type="hidden" value="p" data-bind="value: source" />
        </div>

        <input type="button" data-url="/Wall/SavePost" value="Share" id="btnShare" data-bind="click: addPost">
    </div>
    <ul id="msgHolder" data-bind="foreach: posts">
        <li class="postHolder">

            <img data-bind="attr: { src: PostedByAvatar }" height="50px" width="50px"><p><a data-bind="text: PostedByName"></a></p><p>
                <span data-bind="    html: Message"></span>

                <br />
                <div data-bind="style:{display:LinkThumbnailUrl==''?'none':'block'}" style="padding-left:56px">
                    <iframe data-bind="attr: { src: LinkThumbnailUrl }" height="185px" width="300px"></iframe>
                </div>
            </p>
            <div class="postFooter">
                <a class="linkComment" href="#" data-bind="click: toggleComment">Like</a>&nbsp;&nbsp; <a class="linkComment" href="#" data-bind="    click: toggleComment">Comment</a> &nbsp;&nbsp;<span class="timeago" data-bind="text: PostedDate"></span>
                <span data-bind="text: LikeCount"></span>

                <div class="commentSection">
                    <ul data-bind="foreach: PostComments">
                        <li class="commentHolder">
                            <img data-bind="attr: { src: CommentedByAvatar }" height="50px" width="50px"><p><a data-bind="text: CommentedByName"></a>: <span data-bind="    html: Message"></span></p>
                            <div class="commentFooter"> <span class="timeago" data-bind="text: CommentedDate"></span>&nbsp;</div>
                        </li>
                    </ul>
                    <div style="display: block; padding-top: 10px;" class="publishComment">
                        <textarea class="commentTextArea" data-bind="value: newCommentMessage, jqAutoresize: {}" placeholder="write a comment..."></textarea>
                        <input type="button" value="Comment" class="btnComment" data-bind="click: addComment" />
                    </div>
                </div>
            </div>
        </li>
    </ul>
</div>
@*Scripts.Render("~/bundles/jqueryui")*@
<script type="text/javascript">
    var groupid=@serializer.Serialize(groupid)
</script>
<script src="~/Scripts/jquery.autosize-min.js"></script>
<script src="~/Scripts/jquery.timeago.js"></script>
<script src="~/Scripts/knockout-2.2.0.js"></script>
<script src="~/Scripts/grouppost.js"></script>
